package com.lyz.collectionDemo.collectionSet;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @ClassName SetDemo1
 * @Description Set集合
 * @Author 2214361854
 * @Date 2022/2/21 18:19
 * @Version 1.0
 */
public class SetDemo1 {
    public static void main(String[] args) {
        Set<String> hashSet = new HashSet<>();
        hashSet.add("Mysql");
        hashSet.add("Java");
        hashSet.add("Java");
        hashSet.add("HTML");
        System.out.println(hashSet);

        Set<String> lkHashSet = new LinkedHashSet<>();
        lkHashSet.add("Mysql");
        lkHashSet.add("Java");
        lkHashSet.add("HTML");
        System.out.println(lkHashSet);

        //获取字符串哈希值
        String name = "XML";
        System.out.println(name.hashCode());
    }
}
